package com.example.defaultshop;

import java.util.Calendar;

import android.os.Parcel;
import android.os.Parcelable;

public class Shop implements Parcelable {
	private Calendar deadline;
	private String name, city, zipcode, address, hours, orders, delivery, deliveryText, closed, smiley, picture, hexColor;
	
	private boolean deliver;
	private int idx, deliverPrice, deliverFree, deliverMin, deliverPriceDefault, timeNormal, timeDeliver, version;
	
	public Shop(int idx, int deliverPrice, int deliverFree, int deliverMin, int deliverPriceDefault, int timeNormal, int timeDeliver, int version, boolean deliver, String name, String city, String zipcode, String address, String hours, String orders, String delivery, String deliveryText, String smiley, String closed, String picture, String hexColor) {
		this.idx = idx;
		this.deliver = deliver;
		this.deliverPrice = deliverPrice;
		this.deliverFree = deliverFree;
		this.deliverMin = deliverMin;
		this.deliverPriceDefault = deliverPriceDefault;
		this.timeNormal = timeNormal;
		this.timeDeliver = timeDeliver;
		this.version = version;
		this.name = name;
		this.city = city;
		this.zipcode = zipcode;
		this.address = address;
		this.hours = hours;
		this.orders = orders;
		this.delivery = delivery;
		this.deliveryText = deliveryText;
		this.smiley = smiley;
		this.closed = closed;
		this.picture = picture;
		this.hexColor = hexColor;
		this.deadline = Calendar.getInstance();
	}

	public Shop() {
		this.deadline = Calendar.getInstance();
	}
	
	public int getIdx() {
		return idx;
	}

	public void setIdx(int idx) {
		this.idx = idx;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getZipcode() {
		return zipcode;
	}

	public void setZipcode(String zipcode) {
		this.zipcode = zipcode;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getHours() {
		return hours;
	}

	public void setHours(String hours) {
		this.hours = hours;
	}

	public String getOrders() {
		return orders;
	}

	public void setOrders(String orders) {
		this.orders = orders;
	}

	public String getDelivery() {
		return delivery;
	}

	public void setDelivery(String delivery) {
		this.delivery = delivery;
	}

	public String getDeliveryText() {
		return deliveryText;
	}

	public void setDeliveryText(String deliveryText) {
		this.deliveryText = deliveryText;
	}

	public boolean isDeliver() {
		return deliver;
	}

	public void setDeliver(boolean deliver) {
		this.deliver = deliver;
	}

	public int getDeliverPrice() {
		return deliverPrice;
	}

	public void setDeliverPrice(int deliverPrice) {
		this.deliverPrice = deliverPrice;
	}

	public int getDeliverFree() {
		return deliverFree;
	}

	public void setDeliverFree(int deliverFree) {
		this.deliverFree = deliverFree;
	}

	public int getDeliverMin() {
		return deliverMin;
	}

	public void setDeliverMin(int deliverMin) {
		this.deliverMin = deliverMin;
	}

	public int getDeliverPriceDefault() {
		return deliverPriceDefault;
	}

	public void setDeliverPriceDefault(int deliverPriceDefault) {
		this.deliverPriceDefault = deliverPriceDefault;
	}

	public int getTimeNormal() {
		return timeNormal;
	}

	public void setTimeNormal(int timeNormal) {
		this.timeNormal = timeNormal;
	}

	public int getTimeDeliver() {
		return timeDeliver;
	}

	public void setTimeDeliver(int timeDeliver) {
		this.timeDeliver = timeDeliver;
	}

	public int getVersion() {
		return version;
	}

	public void setVersion(int version) {
		this.version = version;
	}

	public String getSmiley() {
		return smiley;
	}

	public void setSmiley(String smiley) {
		this.smiley = smiley;
	}

	public String getClosed() {
		return closed;
	}

	public void setClosed(String closed) {
		this.closed = closed;
	}

	public String getPicture() {
		return picture;
	}

	public void setPicture(String picture) {
		this.picture = picture;
	}

	public String getHexColor() {
		return hexColor;
	}

	public void setHexColor(String hexColor) {
		this.hexColor = hexColor;
	}

	public Calendar getDeadline() {
		return deadline;
	}

	public void setDeadline(Calendar deadline) {
		this.deadline = deadline;
	}

	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel out, int flags) {
		out.writeInt(idx);
		out.writeInt(deliverPrice);
		out.writeInt(deliverFree);
		out.writeInt(deliverMin);
		out.writeInt(deliverPriceDefault);
		out.writeInt(timeNormal);
		out.writeInt(timeDeliver);
		out.writeInt(version);
		out.writeInt((deliver ? 1 : 0));
		out.writeLong(deadline.getTimeInMillis());
		out.writeString(name);
		out.writeString(city);
		out.writeString(zipcode);
		out.writeString(address);
		out.writeString(hours);
		out.writeString(orders);
		out.writeString(delivery);
		out.writeString(deliveryText);
		out.writeString(smiley);
		out.writeString(closed);
		out.writeString(picture);
		out.writeString(hexColor);
	}
	
	public static final Parcelable.Creator<Shop> CREATOR = new Parcelable.Creator<Shop>() {
		@Override
		public Shop createFromParcel(Parcel in) {
			return new Shop(in);
		}

		@Override
		public Shop[] newArray(int size) {
			return new Shop[size];
		}
	};
	
	private Shop(Parcel in) {
		idx = in.readInt();
		deliverPrice = in.readInt();
		deliverFree = in.readInt();
		deliverMin = in.readInt();
		deliverPriceDefault = in.readInt();
		timeNormal = in.readInt();
		timeDeliver = in.readInt();
		version = in.readInt();
		deliver = (in.readInt() == 1 ? true : false);
		deadline = Calendar.getInstance();
		deadline.setTimeInMillis(in.readLong());
		name = in.readString();
		city = in.readString();
		zipcode = in.readString();
		address = in.readString();
		hours = in.readString();
		orders = in.readString();
		delivery = in.readString();
		deliveryText = in.readString();
		smiley = in.readString();
		closed = in.readString();
		picture = in.readString();
		hexColor = in.readString();
	}
}